﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
    <script src="../Content/scripts/jquery-1.11.1.min.js"></script>
    <script src="../Content/scripts/bootstrap/bootstrap.min.js"></script>
    <link href="../Content/scripts/plugins/jquery-ui/jquery-ui.min.css" rel="stylesheet" />
    <script src="../Content/scripts/plugins/jquery-ui/jquery-ui.min.js"></script>
    <!-- Bootstrap -->
    <link rel="stylesheet" type="text/css" href="../css/bootstrap.min.css" />
    <link href="../Content/styles/font-awesome.min.css" rel="stylesheet" />
    <link href="../Content/adminLTE/css/index.css" rel="stylesheet" />
    <link href="../Content/scripts/plugins/jqgrid/jqgrid.css" rel="stylesheet" />
    <link rel="Shortcut icon" href="../images/favicon.ico" />
    <link href="../Content/styles/learun-ui.css" rel="stylesheet" />
    <script src="../Content/scripts/plugins/layout/jquery.layout.js"></script>
    <script src="../Content/scripts/plugins/dialog/dialog.js"></script>
    <script src="../Content/scripts/plugins/jqgrid/grid.locale-cn.js"></script>
    <script src="../Content/scripts/plugins/jqgrid/jqgrid.min.js"></script>
    <script src="../Content/scripts/plugins/validator/validator.js"></script>
    <script src="../Content/scripts/utils/learun-ui.js"></script>
    <script src="../Content/scripts/utils/learun-form.js"></script>
    <script src="../Content/scripts/plugins/layout/jquery.layout.js"></script>
    <script src="../My97DatePicker/WdatePicker.js"></script>
    <style>
        html, body {
            height: 100%;
            width: 100%;
        }
    </style>
</head>
<body>

    <div class="ui-layout" id="layout" style="height: 100%; width: 100%;">
        <div class="ui-layout-west">
            <div class="west-Panel" style="margin: 0px; border-top: none; border-left: none; border-bottom: none;">
                <div style="color:#9f9f9f;padding-top:5px; padding-bottom:5px;padding-left:8px;"><i style="padding-right:5px;" class="fa fa-info-circle"></i><span>填写内容,选择添加特性</span></div>
                <div style="margin-left: 10px; margin-top: 20px; margin-right: 30px;">
                    <table class="form" id="cushaaddinfo" style="margin-top:10px;">
                        <tr>
                            <th class="formTitle">粗纱机类型<font face="宋体">*</font></th>
                            <td class="formValue" colspan="3">
                                <input id="EquTypeName" type="text" class="form-control" placeholder="请输入粗纱机类型" isvalid="yes" checkexpession="NotNull" />
                            </td>
                        </tr>
                        <tr>
                            <th class="formTitle" valign="top" style="padding-top: 4px;">
                                类型描述
                            </th>
                            <td class="formValue" colspan="3">
                                <textarea id="EquTypeRemark" class="form-control" style="height: 150px;"></textarea>
                            </td>
                        </tr>

                    </table>
                </div>
            </div>
        </div>
        <div class="ui-layout-center">

            <div class="center-Panel" style="margin: 0px; border-right: none; border-left: none; border-bottom: none; background-color: #fff; overflow: auto; padding-bottom: 10px;">
                <div style="color:#9f9f9f;padding-top:5px; padding-bottom:5px;padding-left:8px;"><i style="padding-right:5px;" class="fa fa-info-circle"></i><span>注意:点关闭按钮，就会删除已经保存的特性信息</span></div>
                <div class="titlePanel">

                    <div class="toolbar">
                        <div class="btn-group">
                            <a id="lr-add" class="btn btn-default" onclick="btn_addFeature(event)"><i class="fa fa-plus"></i>&nbsp;新增特性</a>
                            <a id="lr-edit" class="btn btn-default" onclick="btn_editFeature(event)"><i class="fa fa-pencil-square-o"></i>&nbsp;编辑</a>
                            <a id="lr-delete" class="btn btn-default" onclick="btn_deleteFeature(event)"><i class="fa fa-trash-o"></i>&nbsp;删除</a>
                        </div>
                    </div>
                </div>
                <div class="gridPanel">
                    <table id="gridTexing"></table>
                </div>
            </div>
        </div>
    </div>


    <script src="EquInfoJS.js"></script>
    <script>
        $(function () {
            InitialPage();
            $.equinfojs.getEquTypeFeatureList('');
        });

        //初始化页面
        function InitialPage() {
            //layout布局
            $('#layout').layout({
                applyDemoStyles: true,
                west: {
                    size: $(window).width() * 0.4
                },
                spacing_open: 0,
                onresize: function () {
                    $(window).resize()
                }
            });

            $(".center-Panel").height($(window).height() - 40)
            $(".west-Panel").height($(window).height());

        }

        //新增特性信息
        function btn_addFeature(event) {
            //event.preventDefault();
            dialogOpen({
                id: "texingform",
                title: '新增特性信息',
                url: '../Equipment/EquTypeFeatureAdd.html',
                width: "400px",
                height: "400px",
                async: true,
                callBack: function (iframeId) {
                    top.frames[iframeId].AcceptClick($('#gridTexing'));
                }
            });
        }

        //编辑类型特性
        function btn_editFeature(event) {
            //event.preventDefault();
            var keyValue = $("#gridTexing").jqGridRowValue("ID");
            if (checkedRow(keyValue)) {
                dialogOpen({
                    id: "texingeditform",
                    title: '编辑设备类型特性',
                    url: '../Equipment/EquTypeFeatureEdit.html?FeatureID=' + keyValue,
                    width: "400px",
                    height: "400px",
                    async: true,
                    callBack: function (iframeId) {
                        top.frames[iframeId].AcceptClick($('#gridTexing'));
                    }
                });
            }
        }

        // 保存表单
        function AcceptClick(grid) {
            if (!$('#cushaaddinfo').Validform()) {
                return false;
            }

            var EquTypeName = $('#EquTypeName').val();
            var EquTypeRemark = $('#EquTypeRemark').val();
            var EquTypeTexingID = [];

            var obj = $("#gridTexing").jqGrid("getRowData");

            if (obj.length > 0) {
                jQuery(obj).each(function () {
                    //alert(this.ID);
                    EquTypeTexingID.push(this.ID);
                });
                $.equinfojs.saveEquTypeWithTexing(EquTypeName, EquTypeRemark, 1, EquTypeTexingID, grid);

            }
            else {
                $.equinfojs.saveEquType(EquTypeName, EquTypeRemark, 1, grid);
            }
        }

    </script>

</body>
</html>

